<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<jsp:include page="global.jsp"></jsp:include>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>待办业务</title>
<style type="text/css">
.ctl{
	text-decoration: none;
	color: blue;
	margin: auto 7px;
}
.ctl:HOVER{
	text-decoration: underline;
}
.center{
	text-align: center;
}
</style>
</head>
<body>
	<table id="dg" class="easyui-datagrid" title="业务审批"
			data-options="
				rownumbers:true,
				iconCls: 'icon-edit',
				singleSelect: true,
				toolbar: '#tb',
				singleSelect:true,
				fit:true,
				fitColumns:true,
				pageList:[20,25,30,35,40,45,50],
				pageSize:20
			">
		<thead>
			<tr>
				<th data-options="field:'processTypeName',width:60,align:'center'">流程类型</th>
				<th data-options="field:'submitPersonName',width:30,align:'center'">提交人</th>
				<th data-options="field:'processTitle',width:120,align:'center'">流程描述</th>
				<th data-options="field:'submitTime',width:50,align:'center'">提交时间</th>
				<th data-options="field:'processStatusName',width:30,align:'center'">流程状态</th>
				<th data-options="field:'bizId',width:20,align:'center',formatter:formatControl">操作</th>
			</tr>
		</thead>
	</table>

	<div id="tb" style="height:auto">
		<div>
			流程类型:
			<select data-options="editable: false" id = "processTypeId" class="easyui-combobox">
				<option value = ""> --全部-- </option>
				<c:forEach var="item" items="${processTypes}" >
					<option value = "${item.key }">${item.value }</option>
				</c:forEach>
			</select>
			<!-- 
			流程描述：
			<input class="easyui-textbox" id="" style="width: 200px;" />
			 -->
			<a href="javascript:search()" class="easyui-linkbutton" iconCls="icon-search">查 找</a>
		</div>
	</div>	
	
	<jsp:include page="processEditForProjectDelayApply.jsp"/>
	<jsp:include page="processEditForProjectDelayApplyRatify.jsp"/>
	<jsp:include page="processEditForProjectFinishApply.jsp"/>
	<jsp:include page="processEditForProjectFinishApplyRatify.jsp"/>
	<jsp:include page="processEditForProjectMilestoneDelayApply.jsp"/>
	<jsp:include page="processEditForProjectMilestoneFinishApply.jsp"/>
	<jsp:include page="processEditForProjectTaskDelayApply.jsp"/>
	<jsp:include page="processEditForProjectMilestoneFinishApplyQualityCheck.jsp"/>
	<jsp:include page="processEditForProjectTaskFinishApply.jsp"/>
	<jsp:include page="processEditForProjectDelivery.jsp"/>
	
	<script type="text/javascript">
	
	function formatControl(val, row){
		//return '<a class="ctl" href="javascript:void(0)" onclick="lookDetail(\'' + row.orderNumber + '\', \'' + row.name + '\', \'' + row.remark + '\')">查看</a> <a class="ctl" href="javascript:void(0)" onclick="editDept(' + val + ',' + row.orderNumber + ', \'' + row.name + '\', \'' + row.remark + '\')">编辑</a> <a class="ctl" href="javascript:void(0)" onclick="delDept(' + val + ')">删除</a>';
		return '<a class="ctl" href="javascript:void(0)" onclick="processDetail(\'' + row.processTypeId + '\',  \'' + row.processStatusId + '\',\''+row.bizId+'\')">处理</a>';
	}

	function processDetail(processTypeId, processStatusId, bizId){
		//任务延期审核
		if(processTypeId=="0700" && processStatusId=="0200"){
			editForProjectTaskDelayApply(bizId);
		}

		//任务完结审核
		if(processTypeId=="0600" && processStatusId=="0100"){
			editForProjectTaskFinishApply(bizId);
		}
		
		//项目延期申请审核
		if(processTypeId=="0200" && processStatusId=="0200"){
			editForProjectDelayApply(bizId);
		}
		
		//项目延期申请复核
		if(processTypeId=="0200" && processStatusId=="3000"){
			editForProjectDelayApplyRatify(bizId);
		}
		
		//项目完结申请审核
		if(processTypeId=="0100" && processStatusId=="0100"){
			editForProjectFinishApply(bizId);
		}
		
		//项目完结申请复核
		if(processTypeId=="0100" && processStatusId=="3000"){
			editForProjectFinishApplyRatify(bizId);
		}
		
		//项目节点延期审核
		if(processTypeId=="0500" && processStatusId=="0200"){
			editForProjectMilestoneDelayApply(bizId);
		}
		
		//项目节点质量审核
		if(processTypeId=="0300" && processStatusId=="0100"){
			editForprojectMilestoneFinishApplyQualityCheck(bizId);
		}
		
		//项目节点完结审核
		if(processTypeId=="0400" && (processStatusId=="0100" ||processStatusId=="1000")){
			editForProjectMilestoneFinishApply(bizId);
		}
		
		//交付物审核
		if(processTypeId=="0800" && processStatusId=="0100"){
			editForProjectDelivery(bizId);
		}
	}
	
	function search(){
		var processTypeId = $("#processTypeId").textbox("getValue").trim();
		//var submitPersonId = $("#submitPersonId").textbox("getValue").trim();
		var url = "queryProcess?processTypeId="+processTypeId;//+"&submitPersonId="+submitPersonId;
		$("#dg").datagrid('reload', url);
	}

	$(function(){
		search();
	});
	</script>
</body>
</html>